import pandas as pd

# 1.准备数据
col =pd.DataFrame({'color': ['white','red','green','red','green'], 'object': ['pen','pencil','pencil','ashtray','pen'],'price1':[5.56,4.20,1.30,0.56,2.75],'price2':[4.75,4.12,1.60,0.75,3.15]})

# 2.分组+聚合：进行分组，对颜色分组，price1进行聚合
# 2.1 用dataframe的方法进行分组
col.groupby(by="color")["price1"].max()
# 2.2 Series 方式进行分组
col["price1"].groupby(col["color"]).max()